import os
import sys

wav_file = sys.argv[1]

data_dir = '/data7/wavdata/mandarin/16k/datasets'

with open(wav_file, 'r', encoding='utf-8') as f:
    for line in f:
        parts = line.strip().split()
        idx = parts[0]
        path = parts[1]

        split_path = path.split('/')

        folder = '/'.join(split_path[4:-1])

        if not os.path.exists(folder):
            os.makedirs(folder)

        src_path = os.path.join(data_dir, '/'.join(split_path[4:]))
        tgt_path = '/'.join(split_path[4:])
        # print(src_path)
        # print(tgt_path)
        os.system('cp %s %s' % (src_path, tgt_path))
        break
